package com.hundsun.cprs.yyt.service.dilivery.enums;

import java.util.HashMap;
import java.util.Map;

public enum EnumDeliveryCompany {
    EMS("ems","EMS邮政"),
    ST("shentong","申通快递"),
    YT("yuantong","圆通快递"),
    ZT("zhongtong","中通快递"),
    SF("shunfeng","顺丰速运"),
    YD("yunda","韵达快递"),
    TT("tiantian","天天快递")
    ;
    /** 状态值 */
    private String code;
    /** 状态值说明 */
    private String desc;

    private EnumDeliveryCompany(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 全局索引池
     */
    private static Map<String, EnumDeliveryCompany> pool = new HashMap<String, EnumDeliveryCompany>();
    static {
        for (EnumDeliveryCompany et : EnumDeliveryCompany.values()) {
            pool.put(et.code + "", et);
        }
    }

    /**
     * 根据内容索引
     *
     * @param code
     * @return
     */
    public static EnumDeliveryCompany indexByValue(String code) {
        return pool.get(code);
    }

    public static Map<String, EnumDeliveryCompany> toMap() {
        return pool;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
